package my;

import my.entity.Person;
import my.queue.PriorityQueue;

/**
 * <p>
 * 测试
 * </p>
 *
 * @author AJun
 * @since 2020/9/12
 */
public class Main14 {

    public static void main(String[] args) {
        test1();
    }

    static void test1() {
        // Person 实现 Comparable
        PriorityQueue<Person> queue = new PriorityQueue<>();
        // 自定义 Comparator
        // PriorityQueue<Person> queue = new PriorityQueue<>(Comparator.comparingInt(Person::getBoneBreak));
        queue.enQueue(Person.builder().name("Jack").boneBreak(2).build());
        queue.enQueue(Person.builder().name("Rose").boneBreak(10).build());
        queue.enQueue(Person.builder().name("Jake").boneBreak(5).build());
        queue.enQueue(Person.builder().name("James").boneBreak(15).build());

        while (!queue.empty()) {
            System.out.println(queue.deQueue());
        }
    }

}
